Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go: Implement Custom Command with route(Generic Cluster cmd), Ping with Route #2979

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

niharikabhavaraju
Copy link
Collaborator

Go: Implement Custom Command with route(Generic Cluster cmd), Ping with Route

@niharikabhavaraju niharikabhavaraju requested a review from a team as a code owner January 20, 2025 09:49
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed API naming with the team and agreed to follow approach we started with node client. If command have optional argument, we wrap them with options struct and provide 2 APIs: cmd and cmdWithOptions.
Currently PING has 2 optional arguments and 4 APIs (4 permutations):

  • Ping
  • PingWithMessage
  • PingWithRoute
  • PingWithMessageAndRoute

Imagine PING gets a new optional argument later in future. Current solution is not scalable. So the proposal is to refactor it now into the following:

  • Ping
  • PingWithOptions

And follow that approach for all commands.
If you have any concerns, please, share. I'm happy to discuss that there or in a GLIDE contribution meeting.

// the executed
// command.
//
// The command will be routed automatically based on the passed command's default request policy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line

Comment on lines +48 to +49
// the executed
// command.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// the executed
// command.
// the executed command.

Comment on lines +125 to +126
// result, err := client.PingWithMessage("Hello", route)
// fmt.Println(result) // Output: "Hello"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// result, err := client.PingWithMessage("Hello", route)
// fmt.Println(result) // Output: "Hello"
// result, err := client.PingWithMessage("Hello", route)
// fmt.Println(result) // Output: "Hello"

Comment on lines +98 to +99
// result, err := client.Ping(route)
// fmt.Println(result) // Output: "PONG"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// result, err := client.Ping(route)
// fmt.Println(result) // Output: "PONG"
// result, err := client.Ping(route)
// fmt.Println(result) // Output: "PONG"

assert.Nil(suite.T(), err)
value := result.Value()

fmt.Printf("Value type: %T\n", value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants